package com.yxw.live_vod_backend_boot.service.impl;

import com.yxw.live_vod_backend_boot.service.ShopBackendService;
import com.yxw.live_vod_backend_boot.util.UserUtil;
import com.yxw.live_vod_facade.dto.ReviewExamineDTO;
import com.yxw.live_vod_facade.dto.ShopHomepageReviewQueryDTO;
import com.yxw.live_vod_facade.dto.ShopQueryDTO;
import com.yxw.live_vod_facade.feign.ShopFeignClient;
import com.yxw.live_vod_facade.vo.ShopHomePageVO;
import com.yxw.live_vod_facade.vo.UploadSourceMaterialReviewVO;
import com.yxw.yxnet_cd_center.common.dto.PageVO;
import com.yxw.yxnet_cd_center.common.utils.BaseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 店铺后台操作Service业务层处理
 *
 * @author xiexuxin
 * @date 2023-12-04
 */
@Slf4j
@Service
public class ShopBackendServiceImpl implements ShopBackendService {

    @Autowired
    private ShopFeignClient shopFeignClient;

    @Autowired
    private UserUtil userUtil;

    /**
     * 获取店铺列表
     * @param queryDTO
     * @return
     */
    @Override
    public BaseResult<PageVO<ShopHomePageVO>> getShopList(ShopQueryDTO queryDTO) {
        return shopFeignClient.getShopList(queryDTO);
    }

    /**
     * 获取店铺详情
     * @param shopId
     * @return
     */
    @Override
    public BaseResult getShopById(String shopId) {
        return shopFeignClient.getShopHomePage(shopId);
    }

    /**
     * 获取店铺主页审核列表
     * @param queryDTO
     * @return
     */
    @Override
    public BaseResult<PageVO<UploadSourceMaterialReviewVO>> getShopHomePageReviewList(ShopHomepageReviewQueryDTO queryDTO) {
        return shopFeignClient.getShopHomePageReviewList(queryDTO);
    }

    /**
     * 获取店铺审核主页信息详情
     * @param materialId
     * @return
     */
    @Override
    public BaseResult getShopHomePageReviewById(String materialId) {
        return shopFeignClient.getShopHomePageReviewById(materialId);
    }

    @Override
    public BaseResult isShopHomepageReview(ReviewExamineDTO examineDTO) {
        examineDTO.setUserId(userUtil.getLoginUserVo().getUserId());
        examineDTO.setUsername(userUtil.getLoginUserVo().getUserName());
        return shopFeignClient.isShopHomepageReview(examineDTO);
    }

    /**
     * 获取店铺列表
     * @return
     */
    @Override
    public BaseResult getAllShop() {
        return shopFeignClient.getAll();
    }

    @Override
    public BaseResult getBannedUserListByShop(String shopId) {
        return shopFeignClient.getBannedUserListByShop(shopId);
    }


}
